(function($) {
	$.fn.showErrorMsg = function(options) {
		var $form = this;
		
		this.clearErrorMsg();
		
		//显示大概的错误信息
		if (options && options.msg && options.msg != null && options.msg != '') {
			$.confirm({
                title: false,
                content: options.msg,
                autoClose: 'cancel|1000',
                confirmButton:'',
                cancelButton: '关闭'
            });
		}
		
		//显示具体的错误信息
		
		if (options && options.errorMap && options.errorMap != null) {
			for(var errorName in options.errorMap){
				$form.find('#' + errorName + 'Msg').parent().addClass('has-error');
				$form.find('#' + errorName + 'Msg').html(options.errorMap[errorName]);;
			}
		}
		
		var $form = this;
		
	}
	
	$.fn.clearErrorMsg = function() {
		var $form = this;
		$form.find(".has-error").find('.help-block').html('');
		$form.find(".has-error").removeClass('has-error');
	}
})(jQuery);